angular.module('module.shop', [
    'ngCookies'
])
    .config(['$stateProvider',   '$urlRouterProvider',
        function($stateProvider, $urlRouterProvider) {
            $stateProvider
                .state('shoplist', {
                    url : '/shoplist',
                    templateUrl : 'view/shop/list.html',
                    controller : 'ListController'
                })
        }])
    .controller('ListController', ['$scope', '$state','$cookieStore','ShopService',
        function($scope,$state,$cookieStore,ShopService) {
            var myuserid=$cookieStore.get('userid');
            ShopService.getByuid(myuserid).$promise.then(function (shop) {
                $scope.shops = shop;
            })
            $scope.goshop = function(shopid){
                console.log("goshop("+shopid+")");
                $cookieStore.remove('shopid');
                $cookieStore.put('shopid',shopid);
                console.log($cookieStore.get('shopid'))
                $state.go('verification');
            }
        }])
